<template>
  <div class="common-layout">
    <el-container class="main-container">
      <el-header class="main-header">
        <MainHeader />
      </el-header>
      <el-container>
        <el-aside :width="el_aside_width" class="main-aside">
          <MainAside />
        </el-aside>
        <el-main class="main-content">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import MainAside from '@/components/main/MainAside.vue'
import MainHeader from '@/components/main/MainHeader.vue'
import { useAllDataStore } from '@/stores'
import { computed } from 'vue'

const store = useAllDataStore()
const isCollapse = computed(() => store.state.isCollapse)
const el_aside_width = computed(() => {
  return isCollapse.value ? '64px' : '250px'
})
</script>

<style scoped>
.common-layout,
.main-container,
.el-container,
.el-header,
.el-aside,
.el-main {
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  height: 100%;
}

.main-header {
  padding: 0 !important;
  margin: 0 !important;
  height: 60px;
  background-color: #f4e8e8;
  border-bottom: 1px solid #ebeef5;
}

.main-aside {
  padding: 0 !important;
  margin: 0 !important;
  height: 100%;
  border-right: 1px solid #ebeef5;
  background: #f5f7fa;
}

.main-content {
  padding: 0 !important;
  margin: 0 !important;
  height: 100%;
  background: #fff;
}

.el-main {
  padding: 0 !important;
  background: #fff;
  min-height: calc(100vh - 60px);
}
</style>
